1. Field of the Invention
The present invention generally relates to a code phase setting method in a coder which is used for a spread-spectrum communication technique, a PN coder, a GOLD coder and an apparatus using the coder.
2. Description of the Related Art
The spread-spectrum communication technique, which is applied to a CDMA (code division multiple access) communication, is resistant to jamming or interference and offers a high degree of privacy. In the spread-spectrum communication technique, a digitized voice signal is modulated with a spreading code and signals of a plurality of channels are multiplexed within the same frequency band and sent from a sending side. At a receiving side, the voice signal is demodulated (despread) with the same spreading code as the one used for modulating. A PN code or a GOLD code is used for the spreading code. The GOLD code is a code sequence obtained by performing on EXOR (Exclusive OR) operation on two M sequence codes.
FIG. 1 is a conceptual diagram showing a method for assigning a speech channel in CDMA. In CDMA, speech channels are assigned in a frequency band with a unique code for each of the speech channels. A plain parallel to a frequency axis and a power axis at the time of T in FIG. 1 shows that the speech channels are assigned with the unique codes in the direction of the power axis, that is, in the direction of a spectrum power.
FIG. 2 is a block diagram of an example of a communication system using the spread-spectrum communication technique. As shown in the figure, an EXOR operation on a spreading code from a spreading coder 12 and transmitting data is performed in an EXOR circuit 14 such that the transmitting data is spread and modulated. Then, modulated data is sent by a high-frequency circuit 16. At a receiver 20, regenerated data is obtained by demodulating (despreading) received data with a spreading code which has the same waveform as the spreading code used for spreading and modulating the transmitting data.
FIG. 3 is a timing chart showing an operation in the communication system shown in FIG. 2. As shown in FIG. 3, in the example, the spreading code B is a rectangular wave switching at a faster rate than the transmitting data A. That is, as shown in FIG. 3, the value of the spreading code B changes several times in a bit period of the transmitting data A. As mentioned above, received data D which is spread and modulated at the transmitting side is demodulated (despread) with a spreading code E which has the same waveform as the spreading code such that the regenerated data F is obtained.
FIG. 4 is a block diagram of a PN (Pseudo-Random Noise) coder which is used for the spreading coder according to a conventional technique. As shown in the figure, the PN coder includes a shift register in which FFs (flip-flops) 30-34 are cascaded and an EXOR circuit 35. In the example, a code is generated according to a generator polynomial X5+X3+1. The PN coder is an M sequence coder.
The operation of the PN coder will be described in the following. An initial value is set in the FFs, which is an initial state. Stored data in a FF is shifted to a next FF on the right side one after another. A value in the FF 34 is an output of the PN sequence at the time. In addition, an EXOR operation on an output X3 from the FF 32 and an output X5 from the FF 34 is performed in the EXOR circuit 35, and the result is received in the FF 30.
FIG. 5 is a table showing state transitions in the PN coder shown in FIG. 4. As shown in FIG. 5, the register value changes from a state in which X1-X5 are all 1 as phase 0 to a state in which X1-X4 are 1 and X5 is 0 as phase 30. In phase 31, the register value returns to the value of phase 0 and the same state transitions as the state transitions starting from the phase 0 start from phase 31.
FIG. 6 is a block diagram showing a GOLD coder which is also used as a spreading coder. As shown in FIG. 6, the GOLD coder generates a code by performing an EXOR operation on output values from two M sequence coders. As the M sequence coder, for example, the PN coder shown in FIG. 4 can be used. The GOLD code is a non-M sequence code.
When it is necessary to set a specific code phase in the shift register in the above-mentioned PN coder, a value read from a memory in which memory one or a plurality of phase values are stored beforehand is set as an initial value in the shift register, and the specific code phase is set by shifting the initial value a necessary number of times in the shift register in one direction. The memory may be in the PN coder or may be connected to the PN coder.
For example, when the memory stores values of phase 0 and phase 15 beforehand, and when it is necessary to set a value of phase 14 in the shift register, first, a value of phase 0 is set in the shift register as an initial value, then the initial value needs to be shifted 14 times.
However, according to the above-mentioned conventional technology, when the number of the shifts from an initial state is large, it takes much time to set a necessary code phase. In addition, when the number of values which are stored beforehand in a memory is increased, a large amount of memory area becomes necessary.
It is an object of the present invention to provide a code phase setting method in a coder and the coder which reduce time for setting a code phase.
The above object of the present invention is achieved by a code phase setting method in a PN coder which includes a shift register, the code phase setting method including the steps of:
setting an initial value in the shift register;
selecting a direction among two directions in which direction a value in the shift register is shifted; and
setting a code phase by shifting the initial value in the direction a necessary number of times.
According to the above-mentioned invention, since a value in the shift register can be shifted in either direction, it becomes possible to reduce time for setting a code phase from an initial phase.